/*
 * @Author: Sunye
 * @Date: 2025-07-13 23:51:05
 * @LastEditors: Sunye
 * @LastEditTime: 2025-07-14 01:53:56
 * @Description:
 */
const express = require("express");
const cors = require("cors");
const apiRouter = require("./controllers/api.js");

const app = express();

app.use(
  cors({
    origin: "http://localhost:5173",
    credentials: true,
  })
);

app.use(express.json());
app.use(express.urlencoded({ extended: true }));

app.use("/api", apiRouter);

app.use((req, res) => {
  res.status(404).send("<h3>Not Find</h3>");
});

const port = 3000;

app.listen(port, () => {
  console.log(`服务运行在${port}端口`);
});
